Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpcclient: Add retry with backoffs to HTTP POST requests #1743

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

3nprob
Copy link

@3nprob 3nprob commented Aug 21, 2021

Motivation: When used as a library in LND, current behavior means that a
single request failing will result in the entire process shutting down.

This adds behavior similar to the retries of persistent RPC connections
to HTTP request.

  • Initial backoff: 500ms
  • Linear increase
  • Max retries: 10

Room for future improvement:

  • Make configurable
  • Add jitter
  • Tests for retry behavior

Unfortunately due to the way Go http requests are consumed, I had to move down the construction of the request. This resulted in sendPostDetails and sendPost becoming redundant.

@3nprob 3nprob changed the title Add retry with backoffs to HTTP POST requests rpcclient: Add retry with backoffs to HTTP POST requests Aug 21, 2021
@3nprob 3nprob force-pushed the http-retries branch 2 times, most recently from 5b22bc9 to af15cee Compare August 21, 2021 13:04
@coveralls
Copy link

coveralls commented Sep 13, 2021

Pull Request Test Coverage Report for Build 1458619518

  • 0 of 51 (0.0%) changed or added relevant lines in 1 file are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.009%) to 52.955%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/infrastructure.go 0 51 0.0%
Files with Coverage Reduction New Missed Lines %
btcec/signature.go 3 92.82%
peer/peer.go 6 75.57%
Totals Coverage Status
Change from base Build 1444240447: 0.009%
Covered Lines: 21094
Relevant Lines: 39834

💛 - Coveralls

Adds behavior similar to the retries of persistent RPC connections
to HTTP request.

* Initial backoff: 500ms
* Linear increase
* Max retries: 10

Room for future improvement:
* Make configurable
* Add jitter
* Tests for retry behavior
@3nprob
Copy link
Author

3nprob commented Nov 14, 2021

@jcvernaleo @Roasbeef Just rebased on master and resolved the conflicts. Any chance this will be looked at anytime soon ? Have been running with this for lnd for some time with significant improvement in reliability

@jcvernaleo jcvernaleo self-requested a review November 14, 2021 13:48
@jcvernaleo
Copy link
Member

@3nprob I made the actions run and I made a note to review this on Monday.

Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
OK

@jcvernaleo jcvernaleo merged commit cc7327c into btcsuite:master Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants